package com.uqbar.asteroids.components;

import java.awt.Color;
import java.awt.Graphics2D;

import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.appearances.Circle;

public class StandardShoot extends CircleShoot{
	
	public StandardShoot(double posIniX, double posIniY, int grupo){
		super(3,500, posIniX,posIniY);
		this.setAppearance(new Circle(Color.red, 2*this.radio));
		this.dmg = 10;
		this.grupo = grupo;
		this.onSceneActivated();
	}
	
	public void onSceneActivated(){
		
		this.i = 0.5 * 2 - 1;
		this.j = 0 * 2 - 1;
		
		double m = Math.sqrt(this.i * this.i + this.j * this.j);
		
		this.i = this.i / m;
		this.j = this.j / m;
		
		super.onSceneActivated();
	}
	
	public void render(Graphics2D graphics) {
		super.render(graphics);
	}
	
	public void update(DeltaState deltaState) {
		
		if(this.outofScreen()&&this.active){
			this.getScene().shootToPool(this);
			this.toOutScreen();
		}else{
			if(this.active){
				double advanced = this.velocidad * deltaState.getDelta();
				this.move(this.i * advanced, this.j * advanced);
				super.update(deltaState);
			}
		}
	}
	

	
	
	
}
